<{include file="public/header" /}>
<body>

<div style="padding: 10px; background-color: #F2F2F2;padding-bottom: 150px">
  <form class="layui-form layui-form-pane" >
  	<div class="layui-card">
  		<!-- <div class="layui-card-header">请毕业生如实认真填写</div> -->
  		  <div class="layui-card-body">

  			  <div class="layui-form-item">
  			    <label class="layui-form-label">姓名</label>
  			    <div class="layui-input-block">
  			      <input type="text" name="truename" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
  			    </div>
  			  </div>

          <div class="layui-form-item">
            <label class="layui-form-label">学号</label>
            <div class="layui-input-block">
              <input type="text" name="snumber" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
              <input type="password" name="pass" autocomplete="off" placeholder="" class="layui-input" lay-verify="required">
            </div>
          </div>

         <div class="layui-form-item">
            <label class="layui-form-label">班级名称</label>
            <div class="layui-input-block">
              <select name="cid" lay-filter="aihao" lay-verify="required">
                <option value=""></option>
                <{volist name="classes" id="vo"}>
                  <option value="<{$vo.cid}>"><{$vo.title}></option>
                <{/volist}>
              
              </select>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-block">
              <input type="text" name="class" autocomplete="off" placeholder="" class="layui-input" lay-verify="number">
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">年级</label>
            <div class="layui-input-block">
              <select name="grade" lay-filter="aihao" lay-verify="required">
                <option value=""></option>
                <option value="1">高一</option>
                <option value="2">高二</option>
                <option value="3">高三</option>
                
              </select>
            </div>
          </div>

          
          

         
  			
  		</div>
  	 </div>
    <div class="layui-card" style="padding-top: 15px;">
      <!-- <div class="layui-card-header">卡片面板</div> -->
      <div class="layui-card-body">

        <!-- <div class="layui-form-item">
            <input type="hidden" name="img" id="upimgurl" value="">
        </div> -->
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-submit="" type = "button" lay-filter="demo2" id="demo2">提交</button>
        </div>
      </div>
    </div>
  </form>
</div>



<script>

layui.use(['form','element','layer','jquery'], function(){
  var $ = layui.$
  ,form = layui.form,element = layui.element,layer = layui.layer;
  //----------上面引入layui下面开始业务，分割一下-----------------//
   //监听表单提交
  form.on('submit(demo2)', function(data){
    // layer.alert(JSON.stringify(data.field), {
    //   title: '最终的提交信息'
    // })
        layer.confirm('确定提交?', {btn: ['提交','取消'],icon: 3, title:'提示'}
        ,function(index){
          //do something
            $.post("<{:url('do_add')}>",data.field,function(data,status){
              //alert(data);
              //alert(JSON.stringify(data));
              //console(data);
              if(data===1){
                layer.msg('提交成功!',{icon: 6,time:1000},function(index){
                   x_father_close();
                   parent.location.reload();
                });
                
              }else if(data===2){
                
                layer.alert('姓名或学号重复！请勿重复添加！',function(index){
                  layer.close(index);
                }); 
              }else{
                layer.alert('添加数据错误，请刷新重试！',function(index){layer.close(index);});
              }
           })
          
        }
      //   ,function(){
      //     //点击取消的返回值
      //     //layer.msg('quxiao')
      //     window.location.reload()
      // }
      );
     
    
  });
  
});
//删除 预览图片需要加载jquery    
// function deleteImg(obj){
//             obj.parent('.imglist').remove();
//             //var aa=$('div');
//             //aa.remove('#imglist');
// }

</script>


</body>
</html>